package com.nbclass.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.nbclass.domain.PageResult;
import com.nbclass.domain.User;
import com.nbclass.mapper.CheckStudentMapper;
import com.nbclass.service.ICheckStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CheckStudentServiceImpl implements ICheckStudentService {
    @Autowired
    private CheckStudentMapper checkStudentMapper;
    @Override
    public PageResult selectStudentCardStatus(Map<String, String> map) {
        // 1.开启分页查询学生信息
        Page<List<User>> page = PageHelper.startPage(Integer.parseInt(map.get("pageNum")) , Integer.parseInt(map.get("pageSize")));
        // 2.查询学生信息
        List<User> users = checkStudentMapper.selectStudentCardStatus(map);
        // 3.封装分页信息
        PageResult pageResult = new PageResult(page.getTotal(), users);
        return pageResult;
    }
}
